﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01单例模式饿汉式.饿汉式
{
    /// <summary>
    /// 静态内部类  线程安全 不过不推荐使用
    /// </summary>
    public class SingleHungry2
    {
        public static SingleHungry2 GetSingleHungry()
        {
            return InnerClass._singleHungry;
        }       
        public static class InnerClass
        {
            public readonly static SingleHungry2 _singleHungry = new SingleHungry2();
        }
    }
}
